<?php if(!defined('SABLOG_ROOT')) exit('Access Denied');?>
<div id="submenu">
	<ul>
		<li><a href="cp.php?job=template&action=template" <!--{if $action == 'template'}--> class="focus"<!--{/if}-->><span>模板设置</span></a></li>
		<li><a href="cp.php?job=template&action=stylevar" <!--{if $action == 'stylevar'}--> class="focus"<!--{/if}-->><span>模板变量</span></a></li>
		<!--{if $action == 'filelist'}-->
		<li><a href="cp.php?job=template&action=filelist&path=$path" class="focus"><span>编辑模板</span></a></li>
		<!--{/if}-->
	</ul>
</div>

<div id="wrap">
<!--{if $action == 'template'}-->
	<div id="element-left">
		<h2>当前风格&raquo;</h2>
	<!--{if $current_template_info}-->
		<div class="now"><img alt="$current_template_info[name]" src="$current_template_info[screenshot]" border="0" /></div>
		<ul>
			<li>$current_template_info[name]</li>
			<li>制作者:$current_template_info[author]</li>
			<li>适用版本:$current_template_info[version]</li>
			<li>$current_template_info[description]</li>
			<li><a href="cp.php?job=template&action=buildtemplate&path=$options[templatename]">更新缓存</a></li>
			<!--{if $tpledit}-->
				<li><a href="cp.php?job=template&action=filelist&path=$options[templatename]">编辑模板</a></li>
			<!--{/if}-->
		</ul>
	<!--{else}-->
		没有当前主题的相关资料
	<!--{/if}-->
	</div>
	<div id="element-right">
		<h2>可用模板&raquo;</h2>
		<ul>
	<!--{if $available_template_db}-->
		<!--{loop $available_template_db $template}-->
			<li>
				<a href="cp.php?job=template&action=settemplate&name=$template[dirurl]" class="screenshot"><img src="$template[screenshot]" border="0" alt="设置$template[name]主题为当前主题" align="left" height="100" /></a>
				<p><strong><a title="设置$template[name]主题为当前主题" href="cp.php?job=template&action=settemplate&name=$template[dirurl]">$template[name]</a></strong></p>
				<p style="margin-top:10px;"><a href="cp.php?job=template&action=filelist&path=$template[dirurl]">编辑此模板</a></p>
				<p style="margin-top:10px;">适用版本: $template[version]</p>
			</li>
		<!--{/loop}-->
	<!--{else}-->
		  <li>没有可用模板</li>
	<!--{/if}-->
		</ul>
	</div>
<!--{elseif $action == 'stylevar'}-->
	<form action="cp.php?job=template" method="post" name="form">
	<table width="100%" align="center" border="0" cellspacing="0" cellpadding="0">
		<tr class="tdbheader">
		  <td width="4%" nowrap="nowrap">启用</td>
		  <td width="31%" nowrap="nowrap">变量名</td>
		  <td width="61%" nowrap="nowrap">变量内容</td>
		  <td width="4%" nowrap="nowrap"><input name="chkall" value="on" type="checkbox" onClick="checkall(this.form)" /></td>
		</tr>
	<!--{loop $stylevardb $stylevar}-->
		<!--{eval $thisbg = isset($thisbg) && $thisbg == 'tablecell' ? 'tablecell2' : 'tablecell';}-->
		<tr class="$thisbg" onmouseover="this.className='cellfocus';" onmouseout="this.className='$thisbg';">
		  <td nowrap="nowrap"><input type="checkbox" name="visible[{$stylevar[stylevarid]}]" value="1" $stylevar[visible_check] /></td>
		  <td nowrap="nowrap"><b><!--{eval echo '$stylevar['.{$stylevar[title]}.']';}--></b></td>
		  <td nowrap="nowrap"><textarea id="varid_$stylevar[stylevarid]" class="formarea" name="stylevar[{$stylevar[stylevarid]}]" style="width:400px;height:30px;">$stylevar[value]</textarea>
			<b><a href="###" onClick="resizeup('varid_$stylevar[stylevarid]');">[+]</a> <a href="###" onClick="resizedown('varid_$stylevar[stylevarid]');">[-]</a></b></td>
		  <td nowrap><input type="checkbox" name="delete[]" value="$stylevar[stylevarid]" /></td>
		</tr>
	<!--{/loop}-->
		<!--{eval $thisbg = isset($thisbg) && $thisbg == 'tablecell' ? 'tablecell2' : 'tablecell';}-->
		<tr class="$thisbg" onmouseover="this.className='cellfocus';" onmouseout="this.className='$thisbg';">
		  <td nowrap="nowrap"><input type="checkbox" name="new_visible" value="1" checked /></td>
		  <td nowrap="nowrap"><input class="formfield" type="text" name="new_title" value="" /></td>
		  <td nowrap="nowrap"><textarea id="new_value" class="formarea" name="new_value" style="width:400px;height:30px;"></textarea>
			<b><a href="###" onClick="resizeup('new_value');">[+]</a> <a href="###" onClick="resizedown('new_value');">[-]</a></b></td>
		  <td nowrap>新增</td>
		</tr>
		<tr class="tablecell">
		  <td colspan="4" nowrap="nowrap"><div class="records">记录:$total</div>
			<div class="multipage">$multipage</div></td>
		</tr>
	</table>
	<div class="submit">
		<input type="hidden" name="action" value="domorestylevar" />
		<button type="submit">更新 / 删除(所选)</button>
	</div>
	  </form>
<!--{elseif $action == 'filelist' && $tpledit}-->
	<div id="element-left">
		<h2>模板列表 - $path</h2>
		<ul>
		<!--{loop $filedb $fileinfo}-->
			<li class="arrow"><a href="cp.php?job=template&action=filelist&path=$path&file=$fileinfo[filename]&ext=$fileinfo[extension]">$fileinfo[filedesc]</a></li>
		<!--{/loop}-->
		</ul>
	</div>
	<div id="element-right">
		<h2>编辑 - $desc[$file]</h2>
		<!--{if !$writeable}-->
			<p><span class="no">当前模板文件不可写入, 请设置为 0777 权限后再编辑此文件.</span></p>
		<!--{/if}-->
		<form action="cp.php?job=template" method="post" name="form">
			<input type="hidden" name="action" value="savefile">
			<input type="hidden" name="file" value="$file">
			<input type="hidden" name="path" value="$path">
			<input type="hidden" name="ext" value="$ext">
			<textarea id="filecontent" class="formarea" cols="85" rows="25" name="content" style="margin:15px 1px;width:95%;height:400px;font:12px'Courier New';">$contents</textarea>
			<button type="submit">保存</button>
			<button type="reset">重置</button>
		</form>
	</div>
<!--{/if}-->
	  <tr>
		<td class="tablebottom" colspan="6"></td>
	  </tr>
	</table>
  </div>